package sctu.edu.java.year2016.team07.nieying.practice.dishizhang;


import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;

/**
 * Created by Administrator on 2016/6/1 0001.
 */
public class CollectionDome {
    public static void main(String[] args) {
        String a="A",b="B",c="C",d="D",e="E";
        List<String> list=new LinkedList<String>();
        list.add(a);
        list.add(e);
        list.add(d);
        Iterator<String> fristlterator=list.iterator();
        System.out.println(list);
        System.out.println("修改前集合的元素是:\n");
        while(fristlterator.hasNext()){
          System.out.println(fristlterator.next()+" ");
    }
        list.set(1,b);
        list.add(2,c);
        Iterator<String> it=list.iterator();
        System.out.println();
        System.out.println("修改后集合中的元素是: \n");
        while(it.hasNext()){
               System.out.println(it.next()+"");
        }
    }
}
